package com.kbbywyclient.util;

import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.text.TextUtils;

/**
 * Created by Jiangzx on 2017/4/25.
 * 获取AndroidManifest.xml中<meta-mData>标签中的值
 */

public class MetaDataUtils {
    public static String getMetaDataString(Context context,String key){
        String result=null;
        if(context!=null&& !TextUtils.isEmpty(key)){
            PackageManager manager=context.getPackageManager();
            try {
                ApplicationInfo info = manager.getApplicationInfo(context.getPackageName(),
                        PackageManager.GET_META_DATA);
                result=info.metaData.getString(key);
            } catch (PackageManager.NameNotFoundException e) {
                e.printStackTrace();
            }
        }
        return result;
    }
}
